home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / mmailp.idb / usr / lib / Zmail / samples / zscript / findsubj.zsc.z / findsubj.zsc
Encoding:
Text File  |  1997-01-22  |  1.4 KB  |  42 lines

  1. # Sample Z-Script functions: find_references, find_subjects
  2. #              button: Next-Reference
  3.  
  4. function find_references() {
  5. #%
  6. # This is a function that follows message threads.
  7. # It finds all messages that have the Message-Id of the "current"
  8. # message (or, the one specified) in their References: headers.
  9. #%
  10.     # set the current message to one selected (or specified on cmd-line)
  11.     msg_list - $*
  12.     # find all the messages that have the message-id in their References: hdr.
  13.     # "eval -h" expands the %i into the message-id of the selected message.
  14.     # "msg_list ." includes the selected message in the output list.
  15.     eval -h pick -h references %i | msg_list .
  16. }
  17.  
  18. function find_subjects() {
  19. #%
  20. # This function follows message threads by searching for similar subjects
  21. # rather than Reference: headers.  This is a crude way to follow threads,
  22. # but is useful for people who receive messages that do not contain the
  23. # References: header.  Z-Mail supplies References: when replying.
  24. #%
  25.     msg_list - $*
  26.     eval -h pick -s %s | msg_list .
  27. }
  28.  
  29. function thread_next() {
  30. #%
  31. # Find the next message in the thread beginning with the current message.
  32. # It assumes that the messages have already been sorted by date sent.
  33. #%
  34.     if ! $?1
  35.       set _list = .
  36.     else
  37.       set _list = $*
  38.     endif
  39.     find_references $_list | msg_list {^-.} | pick +1 | next
  40. }
  41. button Next-Reference thread_next
  42.